#ifndef BINANCEC__SERVER_THREADPOOL_H
#define BINANCEC__SERVER_THREADPOOL_H

#include <list>
#include <mutex>
#include <semaphore.h>
#include "../../include/strategy/strategyservice.h"

class ThreadPool
{
public:
    ThreadPool(int threadNumber);
    ~ThreadPool();
    bool push(StrategyService*, int);

private:

    std::list<StrategyService*> workList {};
    /*这里需要写成static的原因是想直接在类里写工作线程函数，*/
    static void worker(ThreadPool*);
    void runAllTime();
    std::mutex m_mutex;
    sem_t sem;
    int maxWorkTasks = 100;
};

#endif //BINANCEC__SERVER_THREADPOOL_H
